import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询用户列表
export function listUser(query) {
  return request({
    url: '/system/xyslUser/list',
    method: 'get',
    params: query
  })
}

// 查询用户详细
export function getUser(id) {
  return request({
    url: '/system/xyslUser/' + parseStrEmpty(id),
    method: 'get'
  })
}

// 新增用户
export function addUser(data) {
  return request({
    url: '/system/xyslUser',
    method: 'post',
    data: data
  })
}

// 修改用户
export function updateUser(data) {
  return request({
    url: '/system/xyslUser',
    method: 'put',
    data: data
  })
}


// 修改用户状态
export function changeUserStatus(userId,status) {
  return request({
    url: '/system/xyslUser/changeUserStatus',
    method: 'get',
    params: {"id":userId,"status":status}
  })
}


// 删除用户
export function delUser(id) {
  return request({
    url: '/system/xyslUser/' + id,
    method: 'delete'
  })
}

// 用户密码重置
export function resetUserPwd(id, password) {
  console.log(id);
  const data = {
    id,
    password
  }
  return request({
    url: '/system/xyslUser/resetPwd',
    method: 'put',
    data: data
  })
}
